package com.twu.biblioteca.menu;

import com.twu.biblioteca.Movie;
import com.twu.biblioteca.user.User;

import java.io.IOException;

public class MovieDetails extends MenuItem {
    private static final String PROMPT = "Enter any key to go back to main menu.";

    private final MenuInputReader reader;
    private final Movie movie;

    public MovieDetails(String title, User user, MenuInputReader reader, Movie movie)
    {
        super(title, user);
        this.reader = reader;
        this.movie = movie;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("Movie\tYear\tDirector\tRating\n");
        sb.append(movie.toString() + "\n\n");
        sb.append(PROMPT);
        return sb.toString();
    }

    @Override
    public void run() {
        try
        {
            reader.readString();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
    }
}
